﻿using System;
using System.Windows.Forms;

namespace IMSTools
{
    public delegate void SetControlAttribute(Control control);
    public partial class FmControlAttribute : Form
    {
        public event SetControlAttribute setControlAttribute;
        private Control __control = new Control();
        public FmControlAttribute(Control control)
        {
            InitializeComponent();
            __control = control;
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.OK;
            Control control = new Control();
            control.Name = this.tbControlName.Text;
            control.Text = this.tbControlText.Text;
            setControlAttribute(control);
            this.Close();
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void FmControlAttribute_Load(object sender, EventArgs e)
        {
            this.tbControlName.Text = __control.Name;
            this.tbControlText.Text = __control.Text;
        }
    }
}
